package com.tencent.wxcloudrun.vo.request.user;

import com.tencent.wxcloudrun.domain.TUserAddress;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @Author ZhaoZiYin
 * @Date 2025/4/22
 * @Description 用户保存收货地址请求入参
 */
@Data
@ApiModel(value = "UserSaveAddressReqVo", description = "用户保存收货地址请求入参")
public class UserSaveAddressReqVo {

    @NotNull
    @ApiModelProperty("用户序号")
    private Long userId;

    @ApiModelProperty("收货人")
    private String receUserName;

    @ApiModelProperty("收货手机号码")
    private String receUserPhone;

    @ApiModelProperty("省份")
    private String provinceName;

    @ApiModelProperty("城市")
    private String cityName;

    @ApiModelProperty("区/县")
    private String countyName;

    @ApiModelProperty("街道/镇")
    private String streetName;

    @ApiModelProperty("详细地址")
    private String detailInfo;

    @ApiModelProperty("邮编")
    private String postalCode;

    public TUserAddress build(){
        TUserAddress userAddress = new TUserAddress();
        userAddress.setUserId(this.getUserId());
        userAddress.setReceUserName(this.getReceUserName());
        userAddress.setReceUserPhone(this.getReceUserPhone());
        userAddress.setProvinceName(this.getProvinceName());
        userAddress.setCityName(this.getCityName());
        userAddress.setCountyName(this.getCountyName());
        userAddress.setStreetName(this.getStreetName());
        userAddress.setDetailInfo(this.getDetailInfo());
        userAddress.setPostalCode(this.getPostalCode());
        userAddress.setCreatedBy(String.valueOf(this.getUserId()));
        userAddress.setUpdatedBy(String.valueOf(this.getUserId()));
        userAddress.setCreatedTime(LocalDateTime.now());
        userAddress.setUpdatedTime(LocalDateTime.now());
        return userAddress;
    }

}
